package question2;

/**
 * @FileName Square
 * @Description
 * @Author Sword
 * @date 2024-10-11
 **/
public class Square {


    private int length;

    private int width;

    public Square() {
    }

    public Square(int length, int width) {
        this.length = length;
        this.width = width;
    }

    /**
     * 获取
     *
     * @return length
     */
    public int getLength() {
        return length;
    }

    /**
     * 设置
     *
     * @param length
     */
    public void setLength(int length) {
        this.length = length;
    }

    /**
     * 获取
     *
     * @return width
     */
    public int getWidth() {
        return width;
    }

    /**
     * 设置
     *
     * @param width
     */
    public void setWidth(int width) {
        this.width = width;
    }


    //其中包括计算矩形周长和面积的方法
    public int getPerimeter(int length, int width) {
        return 2 * (length + width);
    }

    public int getArea(int length, int width) {
        return length * width;
    }

}
